<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="common/include :: header('员工修改')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-post-add">
			<input type="hidden" th:value="${employee.id}" id="id" name="id"/>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">姓名：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" th:value="${employee.name}" name="name" id="name" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">邮箱：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" th:value="${employee.email}" name="email" id="email" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">年龄：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" th:value="${employee.age}" name="age" id="age" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">性别：</label>
				<div class="col-sm-8">
					<select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
						<option th:each="dict : ${type}" th:text="${dict.label}" th:value="${dict.value}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">入职时间：</label>
				<div class="col-sm-8">
					<div class="input-group date">
						<input name="hiredate" th:value="${#dates.format(employee.hiredate, 'yyyy-MM-dd HH:mm')}" class="form-control" placeholder="yyyy-MM-dd HH:mm"
							   type="text" required>
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">是否是超管：</label>
				<div class="col-sm-8">
					<select name="admin" class="form-control m-b" th:with="type=${@dict.getType('si_car_package')}">
						<option th:each="dict : ${type}" th:field="${employee.admin}" th:text="${dict.label}" th:value="${dict.value}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">所在部门：</label>
				<div class="col-sm-8">
					<select name="dept.id" th:field="${employee.dept.id}">
						<option value="">所有</option>
						<option th:each="department:${departments}"
								th:text="${department.name}"
								th:value="${department.id}"
						></option>
					</select>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="common/include :: footer" />
	<th:block th:include="common/include :: datetimepicker"/>
	<script type="text/javascript">

		$("input[name='hiredate']").datetimepicker({
			format: "yyyy-mm-dd hh:ii",
			autoclose: true
		});

		var prefix = ctx + "/business/employee";
		function submitHandler() {
	        if ($.validate.form()) {
				//发送ajax请求 传入两个参数,第一个参数为url路径 , 第二个参数为页面新增时请求过来的数据
				//serialize() => 调用serialize()方法就是获取所有的请求参数
	        	$.operate.save(prefix + "/edit", $('#form-post-add').serialize());
	        }
	    }
	</script>
</body>
</html>
